package com.dsz.day5.dfs_bfs;

public class Test {

    public static void main(String[] args) {

        //按上图插入结点
        Solution t=new Solution();
        t.insertNode("V1","V2");
        t.insertNode("V1","V3");
        t.insertNode("V6","V3");
        t.insertNode("V7","V3");
        t.insertNode("V6","V7");
        t.insertNode("V2","V5");
        t.insertNode("V2","V4");
        t.insertNode("V8","V4");
        t.insertNode("V8","V5");
        //获取邻接表
        t.getNodeMap();

        System.out.println();
        System.out.println("-------");
        //输入第一个访问的结点名字
        System.out.print("深度优先遍历：");
        t.dfs("V1");

        //重新设置未访问
        t.setVisit();

        System.out.println();
        System.out.println("-------");
        System.out.print("广度优先遍历：");
        t.bfs("V1");
    }
}
